<script type="text/javascript">
	$(document).ready(function() {
		$("#scholarships").tablesorter({
			widthFixed: true,
			widgets: ['zebra']
		}).tablesorterPager({
			container: $(".pager")
		});
	});
</script>
<div id="main-content" class="prepend-1 span-19 last">
	<h3><?php echo $title; ?></h3>
	<table id="scholarships">
	<thead>
		<tr>
			<th>Nama Beasiswa</th>
			<th width="120">Awal Periode</th>
			<th width="120">Akhir Periode</th>
			<th width="120">Batas Pengajuan</th>
<?php if ($url == 'active') : ?>
			<th width="100">Status Pengiriman</th>
<?php endif; ?>
			<th>Keterangan</th>
		</tr>
	</thead>
	<tfoot>
		<?php echo $pager; ?>
	</tfoot>
	<tbody>
<?php 
	if ($scholarships == NULL) :
		$colspan = 5;
		switch ($url) {
			case 'index':
				$message = 'Tidak ada beasiswa dalam masa pendaftaran.';
				break;
			case 'selection':
				$message = 'Tidak ada beasiswa dalam masa seleksi.';
				break;
			case 'active':
				$colspan = 6;
				$message = 'Tidak ada beasiswa aktif.';
				break;
			case 'nonactive':
				$message = 'Tidak ada beasiswa non-aktif.';
		}
?>
		<tr>
			<td align="center" colspan="<?php echo $colspan; ?>">
				<span class="info"><?php echo $message; ?></span>
			</td>
		</tr>
<?php 
	else :
		foreach ($scholarships as $scholarship) :
?>
		<tr>
			<td><?php echo anchor('sponsor/scholar/detail/'.$scholarship->id, $scholarship->name); ?></td>
			<td align="center"><?php echo date(MONTH_YEAR_FORMAT, strtotime($scholarship->period_start)); ?></td>
			<td align="center"><?php echo date(MONTH_YEAR_FORMAT, strtotime($scholarship->period_end)); ?></td>
			<td align="center"><?php echo date(DAY_FORMAT, strtotime($scholarship->deadline)); ?></td>
<?php if ($url == 'active') : ?>
			<td align="center">
<?php 
	if ($scholarship->delivery == "") {
		echo "-";
	} else {
		echo $scholarship->delivery;
	}
?>
			</td>
<?php endif; ?>
			<td><?php echo $scholarship->details; ?></td>
		</tr>
<?php 
		endforeach;
	endif;
?>
	</tbody>
	</table>
	<div class="clear"><?php echo nbs(); ?></div>
</div>
